<template>
  <div class="detail">
    <h1>{{htmlEncode(info.archive.title)}}</h1>
    <span class="h2">{{info.archive.create_time}}</span>
    <div class="line"></div>
    <rich-text :nodes="info.archive.addondata.content"></rich-text>
    </div>
  </div>
</template>

<script>
    export default {
        name: "index",
      data(){
        return {
          info: {},
          id: ''
          }
      },
      methods:{
		   htmlEncode(text) {
		        if (text) {
		          var arrEntities = { lt: "<", gt: ">", nbsp: " ", amp: "&", quot: '"' };
		          return text.replace(/&(lt|gt|nbsp|amp|quot);/gi, function(all, t) {
		            return arrEntities[t];
		          });
		        } else {
		          return "";
		        }
		      },
          changeInfo(){
            this.id = this.info.recommend_information.id
            this.getInfo()
          },
        async getInfo() {
			this.info = await this.$apis.getNewsDetail({id: this.id});
			
			this.info.archive.addondata.content =  this.info.archive.addondata.content.replace(/\<img/gi, '<img style="width:100%;height:auto" ')
        },
      },
      ﻿onShareAppMessage(res){
    ﻿this.$common.share()
    },
      onLoad(res) {
        ﻿uni.showShareMenu({
          withShareTicket: true
        })
        this.id = res.id
        this.getInfo()
      }
    }
</script>

<style scoped>
  .detail{
    padding: 40rpx 30rpx;
	background-color: #FFFFFF;
  }
  .recommend{
    display: flex;
    background:rgba(253,253,253,1);
    border:1rpx solid rgba(235,235,235,1);
    border-radius:6rpx;
    margin: 80rpx 0 40rpx;
  }
  .icon{
    width: 124rpx;
    height: 124rpx;
    margin-right: 29rpx;
  }
  .title{
    font-size:28rpx;
    font-family:PingFang SC;
    font-weight:bold;
    color:rgba(50,50,50,1);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    line-height: 60rpx;
    margin-top: 12rpx;
    overflow: hidden;
  }
  .des{
    font-size:24rpx;
    font-family:PingFang SC;
    font-weight:bold;
    color:rgba(174,174,174,1);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    overflow: hidden;
  }
h1{
  font-size:40rpx;
  font-family:PingFang SC;
  font-weight:bold;
  color:rgba(50,50,50,1);
}
.line{
  margin-bottom: 80rpx;
}
  .h2{
    font-size:26rpx;
    font-family:PingFang SC;
    font-weight:bold;
    color:rgba(176,176,176,1);
  }
</style>
